import axios from 'axios'


export default {
  namespaced: true,
  state: {
    hotMovieList: {},
  },
  mutations: {
    getHotMovies(state, hotMovies) {
      state.hotMovieList = hotMovies
    },

  },
  actions: {
    async getHotMovies({commit}, {city, currentPage, limit}) {
      await axios({
        url: `/mmdb/movie/v2/list/hot.json?limit=${limit}&offset=${limit * currentPage}&ct=${city}`,
        method: 'GET',
      }).then(res => {
        commit('getHotMovies', res.data.data)
      })
    },

  }
}